package com.szxy.cart.conf;

import com.szxy.cart.inteceptor.UserLoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Auther:zwer
 * @Date:2019/9/26 14:37
 * @Description:com.szxy.cart.conf
 * @Version:1.0
 **/
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private UserLoginInterceptor userLoginInterceptor;

    /**
     * 配置用户登录拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        InterceptorRegistration interceptorRegistration
                = registry.addInterceptor(this.userLoginInterceptor);
        interceptorRegistration.addPathPatterns("/cart/goSettlement");
    }
}
